package com.foreveredu.propms.domain;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

/**
 * Description:<br/>
 * 领域模型：业主类，一个业主可以拥有多个房产<br/>
 * Date:<br/>
 * 2013/3/2<br/>
 * 
 * @author hushigang
 */

@Entity
@Table(name = "T_Owner")
public class Owner implements Serializable {

	private static final long serialVersionUID = 1L;
	private int id;
	private String name;// 业主姓名
	private String workUnit;// 工作单位
	private String phone;// 联系电话
	private String idCard;// 身份证
	private String fmName;// 家庭成员姓名
	private String fmPhone;// 家庭成员联系电话
	private String fmIdCard;// 家庭成员身份证
	private String password;// 查询账单密码
	private Set<House> houses = new HashSet<House>();// 业主拥有的所有房产（双向一对多关系）

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@Column
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column
	public String getWorkUnit() {
		return workUnit;
	}

	public void setWorkUnit(String workUnit) {
		this.workUnit = workUnit;
	}

	@Column
	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	@Column
	public String getIdCard() {
		return idCard;
	}

	public void setIdCard(String idCard) {
		this.idCard = idCard;
	}

	@Column
	public String getFmName() {
		return fmName;
	}

	public void setFmName(String fmName) {
		this.fmName = fmName;
	}

	@Column
	public String getFmPhone() {
		return fmPhone;
	}

	public void setFmPhone(String fmPhone) {
		this.fmPhone = fmPhone;
	}

	@Column
	public String getFmIdCard() {
		return fmIdCard;
	}

	public void setFmIdCard(String fmIdCard) {
		this.fmIdCard = fmIdCard;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@OneToMany(mappedBy = "owner")
	@OrderBy(value = "houseId ASC")
	public Set<House> getHouses() {
		return houses;
	}

	public void setHouses(Set<House> houses) {
		this.houses = houses;
	}
}
